import { GetChannelApi,GetChaneelCountApi} from '@/apis/channles'
import {useState,useEffect} from 'react'

export default function useChannels(){
const [channels, setChannels] = useState([])
    useEffect(() => {
        const fetchChannels = async () => {
            const res = await GetChannelApi()
            setChannels(res.data.channels)
        }
        fetchChannels()
    }, [])

    return {channels}
}

export function useChannelCount(){
const [channelCount,setChannelCount] = useState({})
    useEffect(() => {
        const GetChaneelCount =async()=>{
          const res = await GetChaneelCountApi()
          setChannelCount(res.data.results)
          // const total_count = res.data.total_count
        }
        GetChaneelCount()
    }, [])

    return {channelCount}
}

